# $Id: PKGBUILD 165796 2012-08-30 15:24:19Z tpowa $
# Maintainer: Tobias Powalowski <tpowa@archlinux.org>

pkgname=rpcbind
pkgver=0.2.0
pkgrel=9
pkgdesc="portmap replacement which supports RPC over various protocols"
arch=(i686 x86_64 sh4)
depends=('bash' 'glibc' 'libtirpc')
url="http://rpcbind.sourceforge.net"
license=('custom')
replaces=('portmap')
source=(http://downloads.sourceforge.net/sourceforge/rpcbind/rpcbind-0.2.0.tar.bz2
        rpcbind-sunrpc.patch
        glibc261.patch
        rpcbind.service
        rpcbind)
md5sums=('1a77ddb1aaea8099ab19c351eeb26316'
         'c02ac36a98baac70b8a26190524b7b73'
         'a7b23a32be2eb52d7dec52da36d4eba1'
         '78a963654f57cbb209e228884767836e')

build() {
  cd $srcdir/$pkgname-$pkgver
  # patch for iana services file
  patch -Np1 -i ../rpcbind-sunrpc.patch
  patch -Np0 -i ../glibc261.patch
  ./configure --prefix=/usr --enable-warmstarts --with-statedir=/run
  make
}

check() {
  cd $srcdir/$pkgname-$pkgver
  make check
}

package() {
  cd $srcdir/$pkgname-$pkgver
  make DESTDIR=$pkgdir install
  # install missing man page - https://bugs.archlinux.org/task/21271
  install -m644 man/rpcinfo.8 $pkgdir/usr/share/man/man8/
  # install daemon 
  install -D -m755 $srcdir/rpcbind $pkgdir/etc/rc.d/rpcbind
  # install systemd service file
  install -D -m644 $srcdir/rpcbind.service $pkgdir/usr/lib/systemd/system/rpcbind.service
  # install license
  install -D -m644 COPYING $pkgdir/usr/share/licenses/rpcbind/COPYING
}
md5sums=('1a77ddb1aaea8099ab19c351eeb26316'
         'c02ac36a98baac70b8a26190524b7b73'
         'd2da55270168b0b65e12c4e7ef65e920'
         'a7b23a32be2eb52d7dec52da36d4eba1'
         '78a963654f57cbb209e228884767836e')
md5sums=('1a77ddb1aaea8099ab19c351eeb26316'
         'c02ac36a98baac70b8a26190524b7b73'
         '79c0b5f9373824961b64f8138fc8081f'
         'a7b23a32be2eb52d7dec52da36d4eba1'
         '78a963654f57cbb209e228884767836e')
